package com.kzd.gtboon.main.mine.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.kzd.gtboon.R
import com.kzd.gtboon.entity.*
import com.module.lemlin.image.loadImage
import java.lang.StringBuilder

class MineGiftAdapter : BaseQuickAdapter<GameGift, BaseViewHolder>(R.layout.item_giving_list) {
    init {
        addChildClickViewIds(R.id.tvGameGiftCopy)
    }

    override fun convert(holder: BaseViewHolder, item: GameGift) {
        holder.setText(R.id.tvGameGiftName, item.name)
            .setText(R.id.tvGameGiftContent, StringBuilder().append("礼包内容：").append(item.content))
            .setText(R.id.tvGameGiftCode, StringBuilder().append("礼包码：").append(item.card_no))
            .getView<ImageView>(R.id.ivGameGiftIcon)
            .loadImage(item.icon)
    }
}